<template>
	<view class="app_yaoqing">
		<app-title title='邀请码'></app-title>
		<image style="width: 100%;" :src="res.result.img" mode="widthFix" v-if="res !== ''"></image>
	</view>
</template>

<script>
	import {
		commission_qrcode
	} from '@/api/member.js';

	export default {
		data() {
			return {
				openid: '',
				e: '',
				res: '',
				equipment: ''
			};
		},
		onLoad(e) {
			this.e = e;
		},
		onShow() {
			if (process.env.UNI_PLATFORM === 'h5') {
				// 在H5环境中打开
				console.log('在H5环境中打开');
				this.equipment = 'H5'
			} else if (process.env.UNI_PLATFORM === 'app-plus') {
				// 在App环境中打开
				console.log('在App环境中打开');
				this.equipment = 'App'
			}
			uni.getStorage({
				key: 'openid',
				success: (res) => {
					this.openid = res.data;
					this.commission_qrcodeFun();
				}
			});
		},
		methods: {
			async commission_qrcodeFun() {
				let up = {
					openid: this.openid,
					mid: this.e.id
				}
				let data = await commission_qrcode(up);
				this.res = data;
			},
		}
	}
</script>

<style lang="scss" scoped>
	.app_yaoqing {
		width: 100%;
		background-color: #FB6E4A;
		position: relative;
		height: 100vh;

		image {
			width: 100%;
			// position: absolute;
			// top: 0;
			// left: 0;
			// right: 0;
			// margin: auto;
		}

	}
</style>